package com.woniuxy.demo.epai.controller;


import com.woniuxy.demo.epai.common.Result;
import com.woniuxy.demo.epai.dao.WalletMapper;
import com.woniuxy.demo.epai.model.Members;
import com.woniuxy.demo.epai.model.Wallet;
import com.woniuxy.demo.epai.service.impl.WalletServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户钱包 前端控制器
 * </p>
 *
 * @author epai
 * @since 2021-04-12
 */
@RestController
@RequestMapping("/epai/wallet")
@Slf4j
public class WalletController {
    @Autowired
    private WalletServiceImpl walletService;
    /**
     * 会员成长
     * @param user
     * @return
     */
    @GetMapping("/getWallet")
    public Result getWallet(int id){
        log.info("传入的userId为={}",id);
        Wallet wallet = walletService.getWalletById(id);
        if(wallet==null){
            return Result.fail("查无此人");
        }
        return Result.success(wallet);
    }
}

